<!DOCTYPE html> 
<html lang="en"> 
<head> 
    <meta charset="utf-8"> 
    <meta name="viewport" content="width=device-width, initial-scale=1"> 
    <title>基本信息</title> 
    <link href="css/base.css" rel="stylesheet">
    <link rel="stylesheet" href="jquery-easyui-1.5.3/themes/default/easyui.css">
    <link href="jquery-easyui-1.5.3/themes/icon.css" rel="stylesheet">
    <link href="css/basic_info.css" rel="stylesheet">
    <link rel="stylesheet" href="css/xk.css">
    <script type="text/javascript" src="font_jjkmvgsdpk/iconfont.js"></script>
    <link rel="stylesheet" href="font_jjkmvgsdpk/iconfont.css">
    <link href="css/process.css" rel="stylesheet">
</head> 
<body>
 <div class="container">
  <div class="xk_submit" style="height: 24px;background-color: #eeeeee;bottom: 0;left: 0;right: 0;position: fixed;text-align: center;">
    <button class="easyui-linkbutton" type="button" iconCls="icon-save" style="height: 24px;margin-left: 5px;">保存</button>
    <button class="easyui-linkbutton" type="button" id="jzxxfy" iconCls="icon-large-clipart" style="height: 24px;margin-left: 5px;">打印</button>
    <button class="easyui-linkbutton" type="button" id="jbxx_cancel" iconCls="icon-cancel" style="height: 24px;margin-left: 5px;">取消</button> 
  </div>
  <div class="content">
   <div style="margin-left: 1%;background: linear-gradient(to bottom,#ffffff 0,#F2F2F2 100%);height: 28px;line-height: 28px;border: 1px solid #CCCCCC;padding-left: 5px;">
   <ul id="a_bian"> 
    <li style="float: left;"><span>基本信息</span>&nbsp;&nbsp;|&nbsp;&nbsp;</li>
    <li style="float: left;"><a href="stzpxx"><span>尸检照片</span></a></li>
   </ul>
   </div>
   <form>
   <table class="xk_table">
     <tr>
       <td class="xk_label" colspan="6">尸体编号:J5000000000002019030001<a href="stjbxx">全信息录入</a></td>
     </tr> 
     <tr>
      <td class="xk_label">性别<font>*</font></td>
      <td style="width: 25%;">
        <select class="xk_input" name="" style="width: 90%;">
         <option value="0">未知</option>
         <option value="1" selected="selected">男</option>
         <option value="2">女</option>
        </select>
      </td>
      <td class="xk_label">是否是无名尸体</td>
      <td style="width: 25%;">
        <input type="radio" name="wmst" value="1"><span>是</span>
        <input type="radio" name="wmst" checked="checked" value="2"><span>否</span>
        <span id="wmst">姓名：<input type="" class="xk_input" name=""></span>
      </td>
      <td class="xk_label">体表特殊标记<font>*</font></td>
      <td style="width: 25%;"><input type="text" class="xk_input" id="tbtsbj_val" key="" readonly="readonly" name="" style="width: 90%;">
       <svg class="icon" aria-hidden="true" id="tbtsbj">
        <use xlink:href="#icon-shujuzidian"></use>
       </svg> 
      </td>
     </tr>
     <tr>
      <td class="xk_label">家属是否通意解剖</td>
      <td style="width: 25%;">
        <select class="xk_input" name="" style="width: 90%;">
         <option value="1" selected="selected">是</option>
         <option value="2">否</option>
        </select>
      </td>
      <td class="xk_label">致死原因</td>
      <td style="width: 25%;"><input type="text" id="zsyy_val" key="" readonly="readonly" class="xk_input" name="" style="width: 90%;">
       <svg class="icon" aria-hidden="true" id="zsyy">
        <use xlink:href="#icon-shujuzidian"></use>
       </svg> 
      </td>
      <td class="xk_label">死亡性质</td>
      <td style="width: 25%;">
        <select class="xk_input" name="" style="width: 90%;">
         <option value=""></option>
         <option value="1">他杀</option>
         <option value="2">自杀</option>
         <option value="2">交通意外</option>
         <option value="2">其他意外</option>
         <option value="2">疾病</option>
         <option value="2">待定</option>
        </select>
      </td>
     </tr>
     <tr>
      <td class="xk_label_textarea">衣着情况<font>*</font></td>
      <td colspan="5"><textarea type="text" class="xk_input_textarea" name=""></textarea></td>
     </tr>
     <tr>
      <td class="xk_label_textarea">尸体姿态<font>*</font></td>
      <td colspan="5"><textarea type="text" class="xk_input_textarea" name=""></textarea></td>
     </tr>
     <tr>
      <td class="xk_label">尸检报告</td>
      <td style="width: 25%;"><input type="file" class="xk_input" name="" style="width: 90%;"></td>
      <td colspan="4"></td>
     </tr>
   </table>
   </form> 
  </div>  
 </div>
 <!-- 体表特殊标记树 -->
<div id="div_tbtsbj_tree" class="easyui-dialog" closed="true">
 <div>
  <input type="text" class="xk_input96" readonly="readonly" name="" parentKey="" childKey="" key="" id="tbtsbj_vals" style="margin-left: 1%;">
  <ww:hidden name="itemskeybox" id="selectedKeys"/>
 </div> 
 <ul id="tbtsbj_tree" style="width: 50%;float: left;margin-top: 1px;"></ul>
 <ul style="width: 50%;float: right;margin-top: 4px;" id="ul_tbtsbj_chanyong">
   <li key="0">常用项</li>
 </ul>
</div>
 <!-- 致死原因树 -->
<div id="div_zsyy_tree" class="easyui-dialog" closed="true">
 <ul id="zsyy_tree" style="width: 50%;float: left;margin-top: 1px;"></ul>
 <ul style="width: 50%;float: right;margin-top: 4px;" id="ul_zsyy_chanyong">
   <li key="0">常用项</li>
 </ul>
</div>      
</body>
<script type="text/javascript" src="jquery-easyui-1.5.3/jquery.min.js"></script>
<script type="text/javascript" src="jquery-easyui-1.5.3/jquery.easyui.min.js"></script>
<script type="text/javascript">
 $("#a_bian li:eq(0)").css("color","red"); 
 $("input[name='wmst']").change(function(){
   var val=$(this).attr("value");
  if(val=="2"){
      $("#wmst").attr("style","");
    }else{
      $("#wmst").attr("style","display: none");
    }
})
var tbtsbj_my_array = new Array();
var tbtsbj_value_array = new Array();
var tbtsbj_changyong_vals = new Array();
var tbtsbj_cy_prarent_vals = new Array();
tbtsbj_i = 0;
tbtsbj_j = 0;
tbtsbj_cy_i = 0;
tbtsbj_cy_j = 0;
var tbtsbj_parentValue = "";
var tbtsbj_value = "";
var tbtsbj_key = "";
//对于重复选择的值,不保存
function tbtsbj_RecHasThe(s){
  for (i = 0; i < tbtsbj_my_array.length; i++)
   {
     if( tbtsbj_my_array[i] == s)      return false;     
   }
  return true;
}

$("#tbtsbj").click(function(){
  $("#div_tbtsbj_tree").dialog({
  title:"体表特殊标记多选字典",
  width:"1200px",
  height:"600px",
  closed: false,
  buttons:[
  {
    text:"提交",
    iconCls:"icon-save",
    handler:function(){
      var val = $("#tbtsbj_vals").val();
      $("#tbtsbj_val").val(val);
      $("#div_tbtsbj_tree").dialog("close");
    }
  },
  {
  text:"清空",
  iconCls:"icon-redo",
  handler:function(){
    tbtsbj_my_array = [];
    tbtsbj_value_array= [];
    tbtsbj_changyong_vals= [];
    tbtsbj_cy_prarent_vals= [];
    tbtsbj_i = 0;
    tbtsbj_j = 0;
    tbtsbj_cy_i = 0;
    tbtsbj_cy_j = 0;
    $("#tbtsbj_vals").val("");;
  }
  },{
  text:"设为常用",
  iconCls:"icon-large-smartart",
  handler:function(){
    if(tbtsbj_parentValue != null && tbtsbj_parentValue.length != 0){
      if (tbtsbj_value != null && tbtsbj_value.length!= 0){
        for(var i = 0;i<=tbtsbj_changyong_vals.length;i++){
          if(tbtsbj_changyong_vals.indexOf(tbtsbj_value) != -1){
            return false;
          }else{
            tbtsbj_changyong_vals[tbtsbj_cy_i++] = tbtsbj_value;
            for(var c = 0;c<=tbtsbj_cy_prarent_vals.length;c++){
              if(tbtsbj_cy_prarent_vals[c] == tbtsbj_parentValue){
                break;
              }else{
                tbtsbj_cy_prarent_vals[tbtsbj_cy_j++] = tbtsbj_parentValue;
                break;
              }
            }
            $("#ul_tbtsbj_chanyong").append("<li key='"+tbtsbj_key+"' parentValue="+tbtsbj_parentValue+" onclick='tbtsbj_changyong_val(this)'><button class='easyui-linkbutton' onclick='tbtsbj_changyong_del(this)' type='button' iconCls='icon-no'></button>"+
            "<a href='javascript:;'>"+tbtsbj_value+"</a></li>");
            $.parser.parse("#ul_tbtsbj_chanyong");
          }
        }
      }
    }
  }
 }
 ],
 });  
//体表特殊标记树
$("#tbtsbj_tree").tree({
  url:'json/tbtsbj_tree.json',
    method:"get",
  onLoadSuccess:function(){  
   $("#tbtsbj_tree").tree("collapseAll");  
  },
  onDblClick: function(node){
  if($('#tbtsbj_tree').tree('isLeaf',node.target)){
      tbtsbj_parentValue = $('#tbtsbj_tree').tree("getParent",node.target).text;
      tbtsbj_value = node.text;
     //var parentId = $('#ajxz_tree').tree("getParent",node.target).id;
      tbtsbj_key = node.id;

  if(tbtsbj_RecHasThe(tbtsbj_value)){  
     if (tbtsbj_value != "") {
        tbtsbj_my_array[tbtsbj_i++] = tbtsbj_value;
        if (tbtsbj_parentValue == null || tbtsbj_parentValue == "") {
            tbtsbj_value_array[tbtsbj_j++] = tbtsbj_value;
        } else {
            if (tbtsbj_j == 0) {
                tbtsbj_value_array[tbtsbj_j++] = tbtsbj_parentValue + "：" + tbtsbj_value;
            } else {
                var flag = false;
                for (var k = 0; k < tbtsbj_value_array.length; k++) {
                    var tempValue = tbtsbj_value_array[k];
                    if (tempValue.indexOf(tbtsbj_parentValue) != -1) {
                        tbtsbj_value_array[k] = tbtsbj_value_array[k] + "、" + tbtsbj_value;
                        flag = true;
                        break;
                    } 
                }
                if (!flag) tbtsbj_value_array[tbtsbj_j++] = tbtsbj_parentValue + "：" + tbtsbj_value;
            }
        }
        var totalvalue = tbtsbj_value_array.join("，");
         $("#tbtsbj_vals").val(totalvalue);;
    }
  }
  }
 },
 onClick: function(node){
   if($('#tbtsbj_tree').tree('isLeaf',node.target)){
     tbtsbj_parentValue = $('#tbtsbj_tree').tree("getParent",node.target).text;
      tbtsbj_value = node.text;
     //var parentId = $('#ajxz_tree').tree("getParent",node.target).id;
      tbtsbj_key = node.id;

  }
 }
});
$('#div_tbtsbj_tree').dialog('open'); //打开添加对话框
$('#div_tbtsbj_tree').window('center');//使Dialog居中显示  
}); 
//删除体表特殊标记常用项
function tbtsbj_changyong_del(obj){
 $.messager.confirm("操作提示","确定要删除该常用项吗？",function (data){
  if(data){
   var val = obj.nextSibling.innerText;
   for(var i = 0;i<tbtsbj_changyong_vals.length;i++){
    if(tbtsbj_changyong_vals[i] == val){
      tbtsbj_changyong_vals.splice(i,1);
    }
   }
   obj.parentNode.remove();
  }
 });
}
//给体表特殊标记框赋选定常用值
function tbtsbj_changyong_val(obj){
  var val_val = obj.attributes.parentvalue.value;
  var val = obj.childNodes[1].innerText;
   if(tbtsbj_RecHasThe(val)){  
     if (val != "") {
        tbtsbj_my_array[tbtsbj_i++] = val;
        if (val_val == null || val_val == "") {
            tbtsbj_value_array[tbtsbj_j++] = val;
        } else {
            if (tbtsbj_j == 0) {
                tbtsbj_value_array[tbtsbj_j++] = val_val + "：" + val;
            } else {
                var flag = false;
                for (var k = 0; k < tbtsbj_value_array.length; k++) {
                    var tempValue = tbtsbj_value_array[k];
                    if (tempValue.indexOf(val_val) != -1) {
                        tbtsbj_value_array[k] = tbtsbj_value_array[k] + "、" + val;
                        flag = true;
                        break;
                    } 
                }
                if (!flag) tbtsbj_value_array[tbtsbj_j++] = val_val + "：" + val;
            }
        }
        var totalvalue = tbtsbj_value_array.join("，");
         $("#tbtsbj_vals").val(totalvalue);;
    }
  }
}
var zsyy_val;
$("#zsyy").click(function(){
 $("#div_zsyy_tree").dialog({
  title:"致死原因单选字典",
  width:"700px",
  height:"400px",
  closed: false,
  buttons:[
  {
  text:"选择空值",
  iconCls:"icon-redo",
  handler:function(){
   $("#zsyy_val").val("");
   $("#div_zsyy_tree").dialog("close");
  }
  },{
  text:"设为常用",
  iconCls:"icon-save",
  handler:function(){
    if(zsyy_node != null && zsyy_node.length != 0){
      var li_num = $("#ul_zsyy_chanyong li").length
      var lis = "";
      for(var i = 0;i<li_num;i++){
        lis += $("#ul_zsyy_chanyong li:eq("+i+")").attr("key");
      }
      var zsyy_Id = zsyy_id.toString();
       if(lis.indexOf(zsyy_Id) < 0){
       $("#ul_zsyy_chanyong").append("<li key='"+zsyy_id+"' ondblclick='zsyy_changyong_val(this)'><button class='easyui-linkbutton' onclick='zsyy_changyong_del(this)' type='button' iconCls='icon-no'></button>"+
        "<a href='javascript:;'>"+zsyy_node+"</a></li>");
        $.parser.parse("#ul_zsyy_chanyong");
     }
    }
  }
  }
  ],
 });
 $('#div_zsyy_tree').dialog('open'); //打开添加对话框
$('#div_zsyy_tree').window('center');//使Dialog居中显示
});
//致死原因树
var zsyy_node;
var zsyy_id;
$("#zsyy_tree").tree({
  url:'json/zsyy_tree.json',
    method:"get",
  onLoadSuccess:function(){  
   $("#zsyy_tree").tree("collapseAll");  
  },
  onDblClick: function(node){
  if($('#zsyy_tree').tree('isLeaf',node.target)){
     $("#zsyy_val").val(node.text);
     $("#zsyy_val").attr("key",node.id);
     $("#div_zsyy_tree").dialog("close");
  }
 },
 onClick: function(node){
   if($('#zsyy_tree').tree('isLeaf',node.target)){
      zsyy_node = node.text;
      zsyy_id = node.id;
  }
 }
});
//删除致死原因常用项
function zsyy_changyong_del(obj){
 $.messager.confirm("操作提示","确定要删除该常用项吗？",function (data){
  if(data){
   obj.parentNode.remove();
  }
 });
}
//给致死原因框赋选定常用值
function zsyy_changyong_val(obj){
 $("#zsyy_val").val(obj.innerText);
 $("#zsyy_val").attr("key",obj.attributes.key.value);
 $("#div_zsyy_tree").dialog("close");
} 
</script>
</html>